#!/usr/bin/env python

# Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.

def fifth_power_sum(num):
    return sum([  int(s)**5 for s in str(num) ])

if __name__ == "__main__":
    print sum([ num for num in range(2, 10000000) if num == fifth_power_sum(num) ])
    print [ num for num in range(2, 10000000) if num == fifth_power_sum(num) ]
